Load Python Libraries

Load and Transform Crime Data

Read data into geopandas dataframe

Set coordinate reference system (CRS) to WGS 84 / Pseudo-Mercator

Read in weapon prohibition zone bounding coordinates

Define Functions

Function: KDE and mapping

Function: plotting hotspots

Function: creates a grid

Function: calculates grid data

Function: exports aggregated grid data

(1) Density based analysis

Total police-recorded crimes

Plot Different Criminal Offenses

Types of crime recorded

Subset dataset by violent offenses and theft

Density of violent crimes before and after implementation of the gun-free zone

Density of petty and grand theft before and after implementation of the gun-free zone

(2) Hotspot analysis using Morans I cluster maps

Preparations

Create hexagonal grid overlay

Define export values

Export grid data and run R script to calculate Morans Local I

Load exported and processed data

Moran's I cluster map

Hot and cold spots of total police-recored crimes

Hot and cold spots of petty and grand theft

Hot and cold spots of violence